package qlvbdq.bo;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import qlvbdq.dao.KhachHangDAO;
import qlvbdq.dto.KhachHangDTO;

/**
 *
 * @author THAI HA
 */
public class KhachHangBO {

    public KhachHangBO() {
    }

    public boolean insertKhachHang(KhachHangDTO khdto_) {
        return new KhachHangDAO().insertKhachHang(khdto_) > 0;
    }

    public boolean deleteKhachHang(KhachHangDTO khdto_) {
        return new KhachHangDAO().deleteKhachHangByMa(khdto_.getMaKhachHang()) > 0;
    }

    public boolean updateKhachHang(KhachHangDTO khdto_) {
        return new KhachHangDAO().updateKhachHang(khdto_) > 0;
    }

    public String getNewMaKhachHang() {
        try {
            return new KhachHangDAO().getNewMaKhachHang();
        } catch (SQLException ex) {
            Logger.getLogger(KhachHangBO.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }

    public ArrayList<KhachHangDTO> getAllKhachHang() {
        return null;
    }

    public ArrayList<KhachHangDTO> searchKhachHang(KhachHangDTO khdto_) {
        return null;
    }

    public KhachHangDTO getKhachHang(String maKhachHang_) {
        try {
            return new KhachHangDAO().getKhachHangByMaKH(maKhachHang_);
        } catch (SQLException ex) {
            Logger.getLogger(KhachHangBO.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
    
}
